
import service from "./request";

const requestMethods ={
    
    login:(params)=>{
        return service({
            url:'/user/login',
            method:'post',
            data:params
        })
    },

    registe:(params)=>{
        return service({
                    url:'/user/registe',
                    method:'post',
                    data:params
                })
    },
    getAllTasks:()=>{
        return service({
            url:'/task/getAllTasks',
            method:'get'
        })
    },
    finishedTagetTask:(id)=>{
        return service({
            url:`/task/finishedTaskbyId/${id}`,
            method:'put',
            data:{
                status: 'finished'
              }
        })
    },
    updateTask:(params)=>{
        return service({
            url:`/task/updateTaskbyId`,
            method:'put',
            data:params
        })
    },
    addTask:(params)=>{
        return service({
            url:'/task/insertOneTask',
            method:'post',
            data:params
        })
    },
    getWeekStatusCount:()=>{
        return service({
            url:'/task/get-StatusCount',
            method:'get'
        })
    },
    getAllDepartments:()=>{
        return service({
            url:'/department/getAllDepartments'
        })
    },
    addDepartment:(params) =>{
        return service({
            url:'/department/addDepartments',
            method:'post',
            data:params
        })
    },
    addChildrenDepartment:(params,fatherDepartmentId) => {
        return service({
            url:`/department/createChild/${fatherDepartmentId}`,
            method:'post',
            data:params
        })
    },
    initUserInfo:(params)=>{
        return service({
            url:'/user/initUserInfo',
            method:'put',
            data:params
        })
    },
    getAvatar:() => {
        return service({
            url:'/user/getAvatar',
            method:'get',
       
        })
    },
    getTargetTask:(status) => {
        return service({
            url:`/task/getTasksByStatus/${status}`,
            method:'get',
            
        })
    },
    uploadAvatar:(avatarFile) => {
        const formData = new FormData()

        formData.append("avatar",avatarFile)

        return service({
            url:'/user/upload-avatar',
            method:'put',
            data:formData
        })
    },
    updateDepartmentInfo:(params,departmentId) =>{
        return service({
            url:`/department/updateDpeartmentInfo/${departmentId}`,
            method:'put',
            data:params
        })
    },
    getDepartmentUsers:(params) =>{
        return service({
            url:'/department/getDepartmentUser',
            method:'post',
            data:params
        })
    },
    getUserAllInfo: () =>{ 
        return service({
            url:'/user/getUserAllInfo',
            method:'get',
            
        })
    },
    updateUserBasicInfo:(params) => {
        return service({
            url:'/user/updateUserBasicInfo',
            method:'put',
            data:params
        })
    },
    getAllUsers:() =>{
        return service({
            url:'/user/getAllUsers',
            method:'get',
           
        })
    },
    deleteUserById:(userId) => {
        return service({
            url:`/user/deleteUserById/${userId}`,
            method:'delete',
            
        })
    },
    updateUserById:(params,userId) => {
        return service({
            url:`/user/updateUserById/${userId}`,
            method:'put',
            data:params
        })
    },

}

export default requestMethods